public class TranspositionCommand implements Command {

    private final Genome genome;
    private final int genomeIdx;
    private final int startBlock;
    private final int endBlock;
    private final int insertPosition;

    public TranspositionCommand(int genomeIdx, Genome genome, int startBlock, int endBlock, int insertPosition) {
        this.genomeIdx = genomeIdx;
        this.genome = genome;
        this.startBlock = startBlock;
        this.endBlock = endBlock;
        this.insertPosition = insertPosition;
    }

    @Override
    public void execute() throws ParametersException {
        genome.transposition(startBlock, endBlock, insertPosition, false);
    }

    @Override
    public void undo() throws ParametersException {
        genome.transposition(startBlock, endBlock, insertPosition, true);
    }

    @Override
    public String toString() {
        return "transposition " + genomeIdx+" "+startBlock+" "+endBlock+" "+insertPosition;
    }
}
